﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataObject.DataAccess;

public partial class Pages_Operators_RouteItem : System.Web.UI.Page
{
    #region Properties
    public Guid? RouteID
    {
        get;
        set;
    }

    private object _routeList;
    public object RouteList
    {
        get
        {
            if (_routeList == null)
            {
                _routeList = (HttpContext.Current.Cache["RouteList"] as List<object>);
                if (_routeList == null)
                {
                    _routeList = ParameterDAO.CreateInstant().SelectListItem(null, "Route", "", "", null, true, new HashSet<string>());
                    HttpContext.Current.Cache.Insert("RouteList", _routeList);
                }
            }
            return _routeList;
        }
        set
        {
            HttpContext.Current.Cache.Insert("RouteList", _routeList);
        }
    }
    #endregion

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request["RouteID"] != null)
            {
                RouteID = new Guid(Request["RouteID"]);
            }

            this.ddlRouteNumberInput.DataSource = RouteList;
            this.ddlRouteNumberInput.DataTextField = "ShortValue";
            this.ddlRouteNumberInput.DataValueField = "ShortValue";
            this.ddlRouteNumberInput.DataBind();

        }
    }
}
